package com.example.qxfw.nyqx.mapper;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.qxfw.common.entity.ny.CropyieldHistory;
import com.example.qxfw.nyqx.vo.CropYieldHistoryListVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
@DS("service")
public interface CropyieldHistoryMapper extends BaseMapper<CropyieldHistory> {
    @Select("select year,yield " +
            "from cropyield_history " +
            "where year >= '${year1}' and year <= '${year2}' and stationid = '${stationId}' and type like '%${type}%' and cropname='双季晚稻' " +
            "order by year")
    List<CropyieldHistory> selectList2(String year1, String year2, String stationId, String type);

    @Select("select yield " +
            "from cropyield_history " +
            "where year = '${year}' and stationid='${stationId}' and type='${type}' and cropname='双季晚稻' ")
    List<String> selectYield(String year,String stationId,String type);

    @Select("select yield " +
            "from cropyield_history " +
            "where year = '${year}' and stationid='${stationId}' and type isnull and cropname='双季晚稻' ")
    List<String> selectYield1(String year,String stationId);

    @Select("select yield " +
            "from cropyield_history " +
            "where year = '${year}' and stationid='${stationId}' and type='${type}' and cropname='${cropName}' ")
    List<String> selectYield2(String year,String stationId,String type,String cropName);

    @Select("select yield " +
            "from cropyield_history " +
            "where year = '${year}' and stationid='${stationId}' and type isnull and cropname='${cropName}' ")
    List<String> selectYield3(String year,String stationId,String cropName);

    @Select("select year,yield " +
            "from cropyield_history " +
            "where year >= '${year1}' and year <= '${year2}' and stationid = '${stationId}' and type like '%${type}%' and cropname='${cropName}' " +
            "order by year")
    List<CropyieldHistory> selectList1(String year1,String year2,String stationId,String type,String cropName);
    @Select("select year,yield " +
            "from cropyield_history " +
            "where year >= #{year1} and year <= #{year2} and stationid = '${stationId}' and type like '%${type}%' and cropname='${cropName}' " +
            "order by year" )
    List<CropYieldHistoryListVo> listByYear(long year1, long year2, String stationId, String type, String cropName);
}
